package com.alon.spring01.utils;

import org.apache.commons.codec.binary.Base64;

import java.nio.charset.Charset;

/**
 * @program: spring01
 * @description: 构造Basic Auth认证头信息
 * @author: yulongguang
 * @create: 2019-08-12 15:32
 **/
public class HttpHeaderUtils {
    /**
     * 构造Basic Auth认证头信息
     *
     * @return
     */
    private static String getHeader(String APP_KEY, String SECRET_KEY) {
        String auth = APP_KEY + ":" + SECRET_KEY;
        byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName("US-ASCII")));
        String authHeader = "Basic " + new String(encodedAuth);
        return authHeader;
    }
}
